<?php
	session_start();	
?>

<?php
	if( $_SESSION["admin"] != "" )
	{
?>
<a href="index.php?com=order"><b>List order</b></a>
<br />
<?php
	include_once("process/order.php");	
	$order = new order();	
   $pager = new PS_Pagination($order->_connection, $order->GetListPaging(), 15, 5, "", "?com=order");
	
	$rs = $pager->paginate();

	$table = '<table width="100%" style="font-size:10pt;">
				<tr>
					<td align="center" colspan="9" height="50"><b style="font-size:12pt; color:Blue;">List Order</b></td>
				</tr>
				<tr bgcolor="#996699" style=" font-weight:bold;">						
					<td style="padding:4px;">Order ID</td>
                   <!-- <td style="padding:4px; width:100px;">Description</td>-->
                    <td style="padding:4px;">Customer</td>
                    <td style="padding:4px;">Date created</td>
                    <td style="padding:4px;">Ship info</td>
                    <td style="padding:4px;">Bill info</td>
                    <td style="padding:4px;">Coupon code</td>
                    <td style="padding:4px;">Order status</td>
					<td style="padding:4px;" align="center" width="70px" colspan="2"></td>
				</tr>';
   while($list = mysql_fetch_assoc($rs))
	{
	   if($list['order_status'] == 1)
        {
            $list['order_status'] = "<a href='"."index.php?com=order&func=update&id=".$list['order_id']."'>In active</a>";
         }
         else
         {
            $list['order_status'] = "<a href='"."index.php?com=order&func=update&id=".$list['order_id']."'>Un active</a>";
         }
		$table .= '	<tr bgcolor="#FFFFFF"  onMouseOver="this.bgColor = '."'#C0C0C0'".'" onMouseOut ="this.bgColor = '."'#FFFFFF'".'">
						
						<td style="padding:4px;">
							'.$list['order_id'].'
						</td>
                        	
						<!--<td style="padding:4px; width:100px;">
							'.$list['description'].'
						</td>-->
                        	<td style="padding:4px;">
							'.$list['FirstName'].' '.$list['LastName'].'
						</td>
                        <td style="padding:4px;">
							'.$list['date_created'].'
						</td>
                        	
						<td style="padding:4px;">
							'.$list['ship_info'].'
						</td>
                        	<td style="padding:4px;">
							'.$list['bill_info'].'
						</td>
                        <td style="padding:4px;">
							'.$list['coupon_code'].'
						</td>
						<td style="padding:4px;">
							'.$list['order_status'].'
						</td>
						<td align="center">
							<a onClick="'."return confirm('Do you want to delete this category ?')".'"  style="color:#0033FF" href="index.php?com=order&func=delete&id='.$list['order_id'].'">
								Delete
							</a>
						</td>
					</tr>';
           }
	//endforeach;
	$table .= '</table>';
	echo $table.'<br />';
	echo $pager->renderFullNav();
    }
   else
	{
		echo "<meta http-equiv='refresh' content='0; url=login.php' />";
	}
?>